home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / networking / pgpuam / sources / tprefs.h < prev    next >
Encoding:
Text File  |  2000-06-23  |  1.6 KB  |  65 lines

  1. //    TPrefs.h - Preference Object  
  2. // 
  3. // Apple Macintosh Developer Technical Support
  4. // Written by:  Vinnie Moscaritolo
  5. //
  6. //  Copyright (work in progress)  Apple Computer, Inc All rights reserved.
  7. //
  8. // You may incorporate this sample code into your applications without
  9. // restriction, though the sample code has been provided "AS IS" and the
  10. // responsibility for its operation is 100% yours.  However, what you are
  11. // not permitted to do is to redistribute the source as "DSC Sample Code"
  12. // after having made changes. If you're going to re-distribute the source,
  13. // we require that you make it clear in the source that the code was
  14. // descended from Apple Sample Code, but that you've made changes.
  15. // 
  16.  
  17. #pragma once
  18.  
  19. #ifndef __COLLECTIONS__
  20. #    include <Collections.h>
  21. #endif
  22.  
  23. #define kPrefsFileType         'pref'
  24.  
  25. // ---------------------------------------------------------------------------
  26. //     TPrefs - Preference Object  
  27. // 
  28. // ---------------------------------------------------------------------------
  29. // 
  30. class TPrefs
  31. {
  32. public:
  33.   
  34. //     CONSTRUCTORS AND DESTRUCTORS
  35.               TPrefs();
  36.                          
  37.       virtual  ~TPrefs();            
  38.  
  39. // MAIN INTERFACE
  40.     virtual OSErr     Read();            // read them in
  41.     virtual void     Write();        
  42.     
  43.  
  44.      virtual OSErr     Set( FourCharCode     tag, 
  45.                           SInt32         id,
  46.                          SInt32         itemSize,
  47.                          void *            itemData);
  48.  
  49.     virtual OSErr     Get( FourCharCode     tag, 
  50.                           SInt32         id,
  51.                          SInt32*         itemSize,
  52.                          void *            itemData);
  53.                          
  54. protected:  
  55.     virtual OSErr     GetPrefSpec (FSSpec *fss );
  56.     virtual OSErr      CreatePrefFile(FSSpec *fss);        
  57.  
  58.  
  59. // PRIVATE FIELDS
  60. protected:
  61.      Collection    fCollection;
  62.      
  63.   };
  64.  
  65.